-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #6909: Cache alias givens in lazy vals #7006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, and thank you for opening this PR! 🎉
All contributors have signed the CLA, thank you! ❤️
Commit Messages
We want to keep history, but for that to actually be useful we have
some rules on how to format our commit messages (relevant xkcd).
Please stick to these guidelines for commit messages:
- Separate subject from body with a blank line
- When fixing an issue, start your commit message with
Fix #<ISSUE-NBR>:
- Limit the subject line to 72 characters
- Capitalize the subject line
- Do not end the subject line with a period
- Use the imperative mood in the subject line ("Add" instead of "Added")
- Wrap the body at 80 characters
- Use the body to explain what and why vs. how
adapted from https://chris.beams.io/posts/git-commit
Have an awesome day! ☀️
@nicolasstucki Can you take a look at this? I get:
But I get the same problem when I run this locally at master. So I am not sure what's to blame for it; maybe nothing in the PR itself. |
If you switch to master you probably need to clean That call to I noticed that the signature in the bytecode changed from public final PrimitiveLiftable<Object> Liftable_Int_delegate() to public final Liftable<Object> Liftable_Int_delegate() This might be the source of the problem. |
Yes, that looks likely. The new type, |
Sorry, I inverted the snippets. Master has |
Yes, now the signature is wrong. I forced it to have given Liftable_Int_delegate as Liftable[Int] = primitiveLiftable
private def primitiveLiftable[T <: Unit | Null | Int | Boolean | Byte | Short | Int | Long | Float | Double | Char | String]: Liftable[T] = new PrimitiveLiftable
private class PrimitiveLiftable[T <: Unit | Null | Int | Boolean | Byte | Short | Int | Long | Float | Double | Char | String] extends Liftable[T] {
....
} |
OK, I am out of my wits here. dotty-library-bootstrappedJS fails with this error:
It seems that it tries to generate a lazy val offset variable in an interface. The lazy val is probably generated from the given cache. But the generated lazy val seems to be exactly the same as a user-written one. Who can help and find out what the problem is? Maybe someone has a better idea what this could be. Or we need to start triaging to figure out exactly what file fails. It would be good to finally fix #6909 which has already tripped up several people. |
Here's a more informative error message:
The @sjrd Can you suggest how to fix this? We have an annoying problem here:
In fact, it's likely that a revised LazyVals would also need to generate static ValDefs in traits, so the problem should be fixed on the Js generation side. |
I will see what I can do today. I believe the easiest is actually to change the lazy val transform so that it generates something simpler for JS. The current scheme and the new proposed scheme are both unsuitable for JS, because they use |
Indeed. Maybe it's simplest to always assume @ThreadUnsafe for lazy vals under JS? |
Stale symbol errors can happen when inspecting symbols while comparing the trees before and after pickling.
Restricting `entered` and `enteredAfter` to class members is more a trap to fall into than a helpful check.
The new implementation does not optimize given aliases with pure paths as right hand sides to be vals anymore. The reason is that even a pure path might be expensive to compute so we might want the caching. If we want a precomputed val, we can always for this with an explicit value definition: ``` val x = a.b.c given as T = x ```
It's not necessary anyway, and changes the meaning of `inline`.
The current LazyVals implementation contains initialization code for the OFFSET value. Therefore we cannot set a NoInits flag for traits containing alias givens since these might become lay vals. If the lazy val implementation changes we might be able to revert that commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.